package com.API;

import java.time.*;

public class DateTime07 {
    public static void main(String[] args) {
        LocalDate localDate = LocalDate.of(2000, 8, 28);
        LocalDate localTime = LocalDate.of(2021, 2, 1);
        Period period = Period.between(localDate, localTime);
        System.out.println(period);
        System.out.println(period.getYears());
        System.out.println(period.getMonths());
        System.out.println(period.getDays());
        System.out.println(period.toTotalMonths());
        System.out.println("---------------------");
        LocalDateTime localDateTime = LocalDateTime.of(2020, 1, 23, 4, 23, 4);
        LocalDateTime localDateTime1 = localDateTime.of(2020, 3, 23, 12, 4, 23);
        Duration duration = Duration.between(localDateTime, localDateTime1);
        System.out.println(duration);
        System.out.println(duration.toSeconds());
        System.out.println(duration.toMillis());
        System.out.println(duration.toNanos());
    }
}
